<%@page import="java.util.ArrayList"%>
<%@page import="cn.sendto.model.ParkInfoModel"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="cn.sendto.service.ParkInfoService"%>
<%@page import="cn.sendto.model.CarInfoModel"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.service.CarInfoService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"  errorPage="../err.jsp"%>
	<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>设备信息表</title>
<style >
.txt20 {
	font-size: 20px;
}

.input {
	width: 60px;
	height: 25px;
}
a{
	text-decoration: none;
}
</style>
</head>
<body>
<div class="txt20">当前位置-->查询设备信息</div>
	<%
		request.setCharacterEncoding("UTF-8");
	
		CarInfoService cis = new CarInfoService();
		String select = request.getParameter("select");
	%>
	

	<form action="carlist.jsp" method="post">
		<span>搜索关键字：</span>&nbsp;
		<input type="text" name="select" placeholder="请输入要查询设备关键字">
		&nbsp;&nbsp;<input type="submit" name="查询" value="查询" class="input">
	</form>
	<div align="right" style="width:95%;font-size:25px;"><a href="addcar.jsp">添加设备信息</a></div>
	<%
	if (request.getAttribute("carinfo") != null) {
		out.print("<span style='color:red'>"+request.getAttribute("carinfo")+"</span>");
	}
		List<CarInfoModel> list = new ArrayList<CarInfoModel>();
		if (select == null ) {
			list = cis.allCar();
			out.print("目前共记录了设备信息"+list.size()+"条");
		}
		if (select != null) {
			list = cis.select(select);
			out.print("查询到相关信息"+list.size()+"条");
		}
		if (list.size() > 0) {
	%>
	<div>
		<table width="95%" class="txt12" style="background-color: #00BBEE"
			cellspacing="1" cellpadding="0">
			<tr style="background-color: #EEEEEE; height: 30px">
				<th>编号</th>
				<th>名称</th>
				<th>设备型号</th>
				<th>负责人</th>
				<th>说明状态</th>
				<th>所属教室</th>
				<th>修改</th>
				<th>删除</th>
			</tr>
			<%
				for (int i = 0; i < list.size(); i++) {
			%>
			<tr style="background-color: white; height: 25px;">
				<td align="center"><%=list.get(i).getSbID()%></td>
				<td align="center"><%=list.get(i).getSbname()%></td>
				<td align="center"><%=list.get(i).getSbtype()%></td>
				<td align="center"><%=list.get(i).getChargeman()%></td>
				<td align="center"><%=list.get(i).getStatus()%></td>
				<td align="center"><%=list.get(i).getDepartment()%></td>
				<td align="center"><a href="modcar.jsp?id=<%=list.get(i).getSbID()%>"><img src="../img/edit.gif"></a>

				</td>
				<td align="center"><a href="delcar.jsp?id=<%=list.get(i).getSbID()%>"><img src="../img/delimg.gif"></a>
				</td>
			</tr>
			<%
				}
				}
			%>
		</table>
	</div>
</body>
</html>